package lfm.mpr;

import java.util.ArrayList;

import db.AdminBaseDatosHelper;
import objects.Partido;
import adapter.AdapterListJornadas;
import adapter.AdapterListPartidos;
import android.app.Activity;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.os.Bundle;
import android.widget.ListView;

public class PartidosActivity extends Activity {
	
	private String jornada_id;
	private ListView listView_partidos;
	private ArrayList<Partido> list_partidos;
	private AdminBaseDatosHelper miBBDDHelper;
	private AdapterListPartidos adapter_partidos;
	
	public void onCreate(Bundle savedInstanceState) {
		 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.partidos);
        
        final Bundle extras = getIntent().getExtras(); 
        if(extras !=null)
        {
        	jornada_id = extras.getString("jornada_id");
        }
        
        
        listView_partidos = (ListView) findViewById(R.id.listView_partidos);
        listView_partidos.setFastScrollEnabled(true); 
        int[] colors = {0, 0xFFFF0000, 0}; // red for the example
        listView_partidos.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
        listView_partidos.setDividerHeight(3);
        
        miBBDDHelper = new AdminBaseDatosHelper(PartidosActivity.this);
        list_partidos = miBBDDHelper.Get_partidos_calendario_BD(jornada_id);
        
        adapter_partidos = new AdapterListPartidos(PartidosActivity.this, list_partidos);
        listView_partidos.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        listView_partidos.setAdapter(adapter_partidos);
        adapter_partidos.notifyDataSetChanged();
        
       
	}

}//end_PartidosActivity
